package com.base.abstractdemo;

abstract class Person {
	private int age;
	private String name;

	public Person(int age, String name) {
		this.age = age;
		this.name = name;
	}

	/**
	 * @return age
	 */
	public int getAge() {
		return age;
	}

	/**
	 * @param age
	 *            要设置的 age
	 */
	public void setAge(int age) {
		this.age = age;
	}

	/**
	 * @return name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            要设置的 name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/*
	 * 其他的都是一个人必须的,这里定义一个抽象方法，表示这个抽象类的子类中的人，他想要什么
	 */
	public abstract void want();
}

class Student extends Person {
	private int score;

	public int getScore() {
		return score;
	}

	public void setStore(int age, String name, int score) {
		this.score = score;
	}

	public Student(int age, String name,int score) {
		super(age, name);
	}

	public void want() {
		System.out.println("姓名:" + getName() + "年龄:" + getAge() + " 成绩:" + getScore());
	    
	}
}

class Worker extends Person{
	private int money;
	
	public int getMoney(){
		return money;
	}
	
	public void setMoney(int money){
		this.money = money;
	}
	
	public Worker(int age,String name,int money){
		super(age,name);
		this.money = money;
	}
	
	
	public void want(){
		System.out.println("姓名:" + getName() + "年龄:" + getAge() + " 工资:" + getMoney());
	}
}

/*
 * 抽下类的使用方法
 */
public class Abstractdemo02 {

	public static void main(String[] args) {
         Student s = new Student(10,"xiaomi",100);
         s.want();
         Worker w = new Worker(21,"daming",10000);
         w.want();
         
	}
}



